package zdar.entities;

public class MeleeAction extends Action2{

	public MeleeAction(){
		super();
	}
	
	@Override
	protected int rollToHit() {
		return Dice.roll(getAttribute_hit_value());
	}

	@Override
	protected int rollDmg() {
		return (	Dice.roll(getAttribute_dmg_value()) + (new Dice(getDicecount(), getDiceType(), getDicemod()).roll())	);
	}

	// Note: This action should not even be available if the target is out of range
	// Double note: we probably won't pass the range into the function here
	// These rolls should only cover things as far the Attacker is concerned and will ignore Target factors such as cover, range, dodge, etc.
	@Override
	public Attack getAttack(int range) {
		// range doesn't affect our to hit chance for melee so it will be ignored
		return (new Attack(rollToHit(), rollDmg(), Attack.Type.MELEE));
	}
	public Attack getAttack(){
		return getAttack(0);
	}

}